home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 4.iso / public / fax / src / util / typerules < prev    next >
Text File  |  1994-08-01  |  5KB  |  108 lines

  1. #
  2. # FlexFAX file type rules.
  3. #
  4. # This file contains the file typing rules used by the sendfax
  5. # program to deduce how input files should be prepared for fax
  6. # transmission.  The format of this file is based on the System V
  7. # /etc/magic file used by the file(1) program.  The code that
  8. # reads this file was written entirely based on the comments that
  9. # exist at the top of the magic file and describe how it works.
  10. # The use of magic-style rules is intended to make it easier for
  11. # users to reuse rules already designed for use with file(1).
  12. #
  13. # Each entry defines a type rule.  Entries normally are terminated
  14. # by the end of a line, thought they can be continued across lines
  15. # with a ``\'' (when this is done leading white space is converted
  16. # to a single space).  ``#'' is a comment character; when it appears
  17. # on a line, everything to the right is ignored.
  18. #
  19. # The fields in each entry are:
  20. #
  21. # offset: a byte offset in the file at which data should be extracted
  22. #      and compared to a matching string or value.  If this value
  23. #      begins with '>', then an additional rule is used and scanning
  24. #      continues to the next type rule line that does not begin with
  25. #      a '>'.
  26. # datatype: the type of data value to extract the specified offset in the
  27. #      for comparison purposes.  This can be byte, short, long, or
  28. #      string (a not necessarily null-terminated string of bytes).
  29. #      A byte is 8 bits, short 16 bits, and long 32 bits.
  30. # match:  the value and operation to use in matching; the value used is
  31. #      based on the datatype field.  This value may be "x" to mean
  32. #      "match anything".  The operation is "=" if nothing is specified;
  33. #      otherwise it can be one of ">", "<", "<=", ">=", "!=", "&"
  34. #      (for and-ing and comparing to zero), "^" (for xor-ing and
  35. #      comparing to zero), and "!" (for taking one's complement and
  36. #      comparing to zero).
  37. # result: one of "PS", "TIFF, or "error" (case insensitive).  The first
  38. #      two results specifiy whether the rule generates a PostScript
  39. #      file or a bilevel TIFF image.  The "error" result indicates a
  40. #      file is unsuitable for transmission and if supplied as an
  41. #      argument to sendfax, the command should be aborted.
  42. # rule:      a string passed to the shell to convert the input file
  43. #      to the result format (suitable for sending as facsimile).
  44. #      The rule string is a printf-like string that should use the
  45. #      following "%" escapes:
  46. #        %i    input file name
  47. #        %o    output file name
  48. #        %r    output horizontal resolution in pixels/mm
  49. #        %R    output horizontal resolution in pixels/inch
  50. #        %v    output vertical resolution in lines/mm
  51. #        %V    output vertical resolution in lines/inch
  52. #        %f    data format, 1 for 1-d encoding or 2 for 2-d encoding
  53. #        %w    page width in mm
  54. #        %W    page width in pixels
  55. #        %l    page length in mm
  56. #        %L    page length in inches
  57. #        %s    page size by name
  58. #        %F    the pathname of the fax library (e.g./usr/local/lib/fax)
  59. #        %<x>    the <x> character (e.g. ``%%'' results in ``%''
  60. #
  61. # These are the "null rules"--i.e. for matching formats handled
  62. # directly by the server.
  63. #
  64. #offset    datatype    match        result    rule
  65. 0    string        %!        ps
  66. 0    short        0x4d4d        tiff
  67. 0    short        0x4949        tiff
  68. #
  69. 0    short        000732        tiff    %F/sgi2fax -%f -o %o -v %V\
  70.                           -s %s %i
  71. 0    short        017436        error    packed data
  72. 0    short        017635        error    compressed data
  73. #0    short        0x0506        ps    showcase -p %i
  74. 0    short        0xf702        ps    dvips -q -o %o %i
  75. 0    string        GIF        tiff
  76. >3    string        87a        tiff    gif2tiff -%f -v %V %i %o
  77. >3     string        89a        error    GIF (version 89a)
  78. 0    long        0x59a66a95    tiff    ras2tiff -%f -v %V %i %o
  79. #
  80. # NB: psdit is the Adobe Transcript program for converting ditroff output
  81. 0    string        x T psc        ps    psdit <%i >%o
  82. #
  83. # These are from the PBMPLUS package's auxiliary magic numbers file
  84. # Most of these entries use the "string" format so that they will work on
  85. # both big-endian and little-endian machines.
  86. #
  87. 0    string        begin        error    uuencoded file
  88. 0    string        xbtoa        error    btoa'd file
  89. 0    string        P1        error    PBM file
  90. 0    string        P2        error    PGM file
  91. 0    string        P3        error    PPM file
  92. 0    string        P4        error    PBM "rawbits" file
  93. 0    string        P5        error    PGM "rawbits" file
  94. 0    string        P6        error    PPM "rawbits" file
  95. #
  96. 0    string        WNGZWZSS    error    Wingz spreadsheet
  97. 0       string          #Inventor V    error    IRIS Inventor file 
  98. >15     string          binary        error    binary IRIS Inventor file
  99. >15     string          ascii        ps    %F/textfmt -f Courier-Bold\
  100.                             -p 11 -s %s >%o <%i
  101. #
  102. # This causes anything else with ascii-only data to be treated as text.
  103. # Note that we use an explicit pathname for lptops because it might be
  104. # installed elsewhere on the system and our version is very different.
  105. #
  106. 0    ascii        x        ps    %F/textfmt -f Courier-Bold\
  107.                             -p 11 -s %s >%o <%i
  108.